#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main() {
    // 打开文本文件
    ifstream file("text.txt");

    if (!file.is_open()) {
        cout << "文件打开错误" << endl;
        return 1;
    }

    // 统计字符数和单词数
    string word;
    int charCount = 0, wordCount = 0;
    while (file >> word) {
        charCount += word.size();
        wordCount++;
    }

    // 输出结果
    cout << "字符数= " << charCount << endl;
    cout << "单词数= " << wordCount << endl;

    return 0;
}